Return to doc.sitecore.com

1.  Installation Guide (Sitecore 5.1)
Prev Next

The SQL Data Provider is distributed as a standard Sitecore package. Thus, to start using it, you should install the package. Please refer to the 'Installing Modules and Packages' article if you are not familiar with the standard Sitecore Packager tool.

The following steps are required to make this example work:  

  1. Make sure you have the Northwindsample MSSQL database, which is available for any MS SQL installation (except MSDE), installed.
     
  2. Install the sqldataprovider.zip package.
     
  3. Modify the web.config file  

The sqldataprovider.zip package adds the following Items to Sitecore:

 

  1. Templates:
    /system/templates/SQLProvider/NorthwindCustomer
    id: {31975406-5987-4390-9151-8F28D11683A4} with the fields:
    ContactName :Text
    CompanyName:Text
    Address:Text
    City
    :Text
     
    /system/templates/SQLProvider/NorthwindCustomer
    id: {9AFF70A1-31E4-48F9-8461-F0DC33F4F77C} with no fields (this template only serves as a root Item template).
     
  2. An Item
    /content/Home/SqlProvider
    This Item in the content tree will serve as a parent for all dynamically provided Items. These Items are shown in the content tree of the Master database, but, in fact, they are located in an external database.  

1.1.  Make changes to the web.config file

1.1.1.  Add the <dataProvider ref="dataProviders/northwind"/> definition as shown below:

<!-- master -->
<database id="master" singleInstance="true" type="Sitecore.Data.Database, Sitecore.Kernel">
    
<param desc="name">$(id)</param>
        
<dataProviders hint="list:AddDataProvider">          
<!-- ADD THE LINE BELOW -->
<dataProvider ref="dataProviders/northwind"/>    
<dataProvider ref="dataProviders/main" param1="$(id)"/>
        
</dataProviders>
    ...
    
</database>

1.1.2.  Add the <northwind... </northwind> definition as shown below:

 

    <dataProviders>
          
<main type="Sitecore.Data.DataProviders.$(database)DataProvider, Sitecore.$(database)">
        
<param ref="connections/$(1)"/>
          
</main>

          
<northwind type="NorthWind.NorthwindProvider,northwind">
          
<param desc="connection">server=(server);User=(user);password=(password);database=northwind</param>
        
<param desc="table">(table name)</param>
            
<param desc="fieldsNames">ColumnName1,ColumnName2, ...</param>
        
<param desc="idField">(ID Column name)</param>
              
<param desc="nameField">ContactName</param>
        
<param desc="filter">(filter)</param>
            
<param desc="templateID">(item template id)</param>
        
<param desc="parentTemplateID">(parent template id)</param>
            
<param desc="hostDatabase ">(host database)</param>
      
</northwind>
...
    
</dataProviders>

Restart the Client and go to the Content Editor. Expand the /content/home/SQLProvider Item in the Master database. You will be able to see all Items extracted by the Data Provider:
/upload/sdn5/shared library/data providers/sql data provider/northwind_data_provider.png

 


Prev Next